1. Field of the Invention
This disclosure relates generally to distributed environment synchronizers, and, more particularly, to out-of-line monitors for shared objects stored in read-only memory.
2. Description of Related Art
It is often desirable to share data structures between threads or processes in a distributed computing environment to coordinate and communicate between multiple threads or processes in execution. However, implementation of a shared object invariably requires the implementation of access control. A monitor is one data structure that satisfies this need. A monitor enables mutually exclusive access to variables within the shared object. Additionally, a monitor allows one thread or process to wait for conditions triggered by another thread or process accessing the shared object. Monitors are therefore successful data structures for implementing access control.
Monitors typically require some form of mutability to indicate and handle a “contention” event, which occurs when one computing thread or process attempts to acquire a lock on a shared object while the lock is already held by another thread or process. Monitor data is traditionally stored in the header for a shared object. This presents a challenge when the shared object is stored in read-only memory, because a read-only object will invariably have a read-only header. The common solution places the monitor data within a table, rather than in the header. In a mixed environment containing both read-only and read-write objects, this solution causes unnecessary performance degradation, because read-only and read-write objects are identical from the viewpoint of the managed runtime. A table search would be required to access the monitor of any object. The traditional solution of referencing monitor information within the object headers is far more optimal.